package com.ifd.iview.controller;

import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zk.ui.util.Initiator;

import com.ifd.iview.utils.IviewUtils;

public class InitController extends GenericForwardComposer implements Initiator {
	@Override
	public void doInit(Page page, Map<String, Object> args) throws Exception {
		Subject user = SecurityUtils.getSubject();
		if(!user.isAuthenticated())
			IviewUtils.sendRedirect(IviewUtils.getResourceURI("/pages/user/login.zul"));
		else
			IviewUtils.sendRedirect(IviewUtils.getResourceURI("/pages/main.zul"));
	}
}
